package com.itheima.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itheima.dao.Login;
import com.itheima.domain.Person;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginService {
    @Autowired Login login;
    public boolean b( String username, String password){
        LambdaQueryWrapper wrapper = new LambdaQueryWrapper<Person>().eq(Person::getPassword,password).eq(Person::getUsername,username);
        Person person = login.selectOne(wrapper);
        boolean a= true;
        try {
            System.out.println(person);

            if ("null".equals(person.getPassword())) {
                System.out.println(person + "11111111111111");
            }
        }catch (Exception e){
           a=false;
            System.out.println(a);
        }

        return a;
    }
}
